Virtual Memory Virtual memory is a technique that allows you to transform some of your (inexpensive) hard drive space into (more valuable) application memory. It means that you can use more application memory than the amount of physical RAM you have installed in your Mac. For example, a Mac IIcx with 5MB of RAM can easily be set to have 13MB of application memory using virtual memory (even with 32–bit addressing turned off). This means you could have 2MB of RAM taken up by the Operating System and still open three 3MB applications and one 2MB application. Speed of Virtual Memory Virtual memory is slower than a comparable amount of real RAM, but not necessarily by much. Virtual memory works by keeping some of the information normally stored in RAM in a special file on the hard drive known as the swap file or backing store. It works especially well with System 7 and System 6 MultiFinder since the foreground application can be given most of the real RAM and the background applications can be “swapped out” to the hard drive, ready to be copied up to RAM whenever they are brought to the foreground. The important parameter is the ratio between the amount of real RAM not being used by the System (that is, the physical RAM minus 2MB or so) as compared to the size of the largest single application you want to run. As long as they are nearly equal, virtual memory should not noticeably slow down your computer. Connectix first brought this technology to the Macintosh in 1988 with its award–winning product, Virtual, and today VM is a standard feature of System 7. Virtual 3.0 brings some significant improvements to VM and we recommend it if you find you need virtual memory frequently or have limited hard drive space. Connectix Virtual is optimized for speed, and can be configured to use up much less hard drive space than standard VM. VM always requires 1MB of hard drive space for each megabyte of application memory, regardless of the amount of physical RAM installed. By comparison, Virtual only requires hard drive space equal to the application memory minus the amount of physical RAM installed. Many products which are not compatible with VM work with Virtual 3.0 (for example, System 6, accelerated Compact Macs, and some hard drive drivers). If you do use System 7 VM, you may be able to slightly improve its performance by making sure the swap file is contiguous. The best way to do this is to optimize your drive with one of the major hard drive utilities. Another issue with System 7 VM occurs in 24–bit mode when more than 8MB of physical RAM is installed. In this case VM cannot be turned on and only 8MB of physical RAM can be addressed. Usually, the easiest solution to this problem is to install Connectix MAXIMA. Hardware Requirements To use virtual memory you need a Memory Management Unit (MMU). This is built into the 68030 and 68040 processors. So the Classic II, SE/30, LC II, IIx, IIcx, IIci, IIsi, IIvx, IIfx, and Quadras can run virtual memory without modification. The Mac II is based on the 68020 processor which has no MMU, so it needs a memory coprocessor called a PMMU. The LC is also based on the 68020, but has no socket for a PMMU. The only way to run virtual memory on an LC is to install a 68030 or 68040 accelerator. The Mac Plus, SE and Classic can run Connectix Compact Virtual if they are upgraded with a 68030 accelerator. Compact Virtual provides 16MB of virtual memory on these systems. System 7 VM does not work with the accelerated Mac Plus, SE or Classic. There is no virtual memory solution for the 68000–based Portable or PowerBook 100. The PowerBook 140/145, 160 170, 180 and the Duos can run standard System 7 VM or Connectix Virtual without modification. However, this runs down the batteries quickly because the hard drive must always be kept spinning. Connectix Virtual automatically disables itself to conserve battery power. Purchasing PMMUs The original 68020–based Mac II requires a Motorola 68851 Paged Memory Management Unit (PMMU) in order to run System 7 VM, A/UX, MODE32, Connectix Virtual, or Connectix MAXIMA unless the Mac II has been upgraded with a 68030 or 68040 processor. The Mac II incorporates a motherboard socket specifically designed for this memory coprocessor. The current (and final) shipping version of the Paged Memory Management Unit is the Mask 73 Motorola MC68851RC16A. This is the version which Apple carries on its parts list. Surplus parts of earlier versions (Masks) may be available, but may not work properly. The Mask number can be identified by looking at the second line on the chip. The first or second digit on this line should be a letter “B.” The Mask number is found in the two digits that follow the “B.” All parts shipped by Motorola since March, 1989 are Mask 73. Earlier generations (in reverse chronological order) were Mask 36, 96, and 87. These are not recommended for use with the Macintosh. PMMUs are also available in different speed ratings. This is designated by the number after the letters RC on the first line. The Mac II is clocked at 16MHz, so it needs a 16MHz PMMU. Do not buy a PMMU with an RC number less than that. So, for example an MC68851RC16A is a good part, but an XC68851RC12 is not. Some RC12 parts are available on the market for a low price, but these are likely to produce intermittent crashes after days, weeks, or months of use. Using Large Amounts of Memory Things are pretty simple on any Portable Mac, on a Modular Mac as long as you don’t need more than 8MB of memory, or on a Compact Mac if you are satisfied with 4MB. In this case just follow the four SIMM rules (see “About SIMMs”). But, if you are doing high–end graphics, animation, CAD, modeling, or any of the plethora of memory–intensive Mac jobs, then you may need special software to use high memory. Operating System Memory Limitations The main issue is that when you install more memory in your Macintosh, the operating system sometimes does not recognize that the memory is there. In particular, the 24–bit addressing mode (standard on System 6, optional on System 7) can only use 8MB of memory on a Modular Mac, or 4MB on a Compact Mac. The two basic ways to deal with this on a Modular Mac are to use 32–bit addressing (see next subsection) or enhanced 24–bit addressing (follows next subsection). The 32–bit addressing mode allows a Modular Mac to use up to 256MB of RAM, while the enhanced 24–bit mode extends 24–bit addressing from 8MB to 14MB. The advantage of 24–bit addressing mode is that it is compatible with the full range of Macintosh software, whereas only “32–bit clean” applications and extensions will run in the more powerful 32–bit mode. The 68000–based Compact Macs, the Plus, SE, and Classic, cannot use 32–bit addressing but there are good 24–bit alternatives (see “Using More Than 4MB on Compact Macs”). The 68030–based Classic II and the SE/30 work like Modular Macs in terms of 24 and 32–bit addressing, so the following two subsections also apply to them. 32–Bit Addressing 32–bit addressing is a feature of System 7 that increases the amount of application memory you can address (use). You can add it to System 6 by installing OPTIMA. It is not related to 32–bit Quick Draw, 32–bit color, or how many colors can show on your screen or video image. An address is a unique serial number which specifies the location of each byte of information in application memory. Every Modular Mac since the Mac II has been built with hardware that can use 32 bits (a binary number 32 digits long, such as 11010010010100100101001010111011) for addresses but, until recently, only the first 24 bits have been used by the operating system. This “24–bit mode” limited the Mac to using a maximum of 16MB of addressable memory, of which the lower 8MB was assigned to application memory, and the upper 8MB was assigned to NuBus cards, ROMs, and various other devices (see “History of Macintosh Memory”). When 32–bit addressing is turned on, all 32 digits are used for address information, meaning that up to 4 billion locations (4 gigabytes) can be uniquely identified. This totally eliminates the 8 megabyte limit. There are still some hardware limitations in the SIMM socket design, so “only” 128 megabytes of physical memory (eight 16MB SIMMs) can be installed on a standard Modular Mac and up to 256MB on a Quadra 900 or 950. That is the maximum physical RAM you can use as application memory under 32–bit addressing. And, because of memory fragmentation (see “Memory Fragmentation”) only the first quarter of the memory map, that is one gigabyte (1024 megabytes), can be used for virtual memory. Still, for most people, 128MB of physical RAM, extensible to as much as 1024MB of virtual memory is plenty. The easiest way to get this if you use a Classic II, LC, LC II, IIci, IIsi, IIvx, IIfx, or a Quadra is to run System 7 with 32–bit addressing turned On. To find out if 32–bit addressing is available, look in the Memory control panel. If you have an early Modular Mac (II, IIx, IIcx, or SE/30) running System 7, just install MODE32 and you can do exactly the same thing. System 6 users of all Modular Mac systems (except Quadras) can get 32–bit mode by installing Connectix OPTIMA. OPTIMA is not compatible with MultiFinder, so only Finder may be used. 32–bit addressing is not available on the Mac Plus, SE, or Classic, but Compact Virtual 3.0 supports 16MB of physical or virtual memory if a 68030 accelerator is installed (see “More than 4MB on Compact Macs”). There is no 32–bit addressing or other high memory solution for the Portable or PowerBook 100. Although the PowerBook 140/145 and 170 can use 32–bit addressing mode, there is little point since total installed RAM is limited physically to 8MB (see “Using More Than 4MB on Compact Macintoshes”). The PowerBook 160, 180 and Duos can benefit from 32–bit addressing mode. 32–bit addressing is limited on the Classic II, LC, and LC II to 10MB by the ROMs in these systems. So, for example, if you put two 4MB SIMMs into a Classic II you have a total of 12MB(including the built–in 4MB). But you can only use 10MB, even in 32–bit addressing mode because of the ROMs. Sometimes 32–bit addressing cannot be used because an application, extension, control panel or software built into some peripheral device is not compatible with this mode. Then, 24–bit addressing must be used. (See next section.) 32–bit addressing is imperceptibly faster than 24–bit addressing. The only significant speed improvement comes if it enables you to eliminate I/O bottlenecks by enabling you to add more memory (see “Benefits of Adding Memory”). 24–Bit Addressing As we mentioned above, the disadvantage of 32–bit addressing is that not all applications, extensions, and other software are compatible with this mode. The alternative is to stay in the much more compatible 24–bit mode and enhance it with MAXIMA. 24–bit mode is the standard addressing mode of System 6 and is also what you get under System 7 when 32–bit addressing is off, or is not available. In standard 24–bit mode only 8MB out of the total available 16MB is normally able to be used as application memory on a Modular Mac. MAXIMA extends 24–bit addressing by adding some of the upper 8MB into application memory, while still using 24 digit long addresses. It gets most of this extra memory by using addresses originally allocated for six NuBus cards (which are rarely all used, and on many systems cannot all be used anyway.) On Macs using only one NuBus card (or on–board video), MAXIMA extends addressing in 24–bit mode to 14MB and turns the rest into a protected, non–volatile RAM Disk (see “RAM Caches, Disks, and Drives”). For each additional NuBus card installed, MAXIMA creates one less megabyte of extended memory. Connectix Virtual and System 7 VM use similar techniques to extend virtual memory in 24–bit mode, and lose the capability to create memory if multiple NuBus cards are installed. System 6 users are always in 24–bit mode unless Connectix OPTIMA is installed. If you don’t use OPTIMA, MAXIMA is required for high RAM configurations under System 6. Note that any of the 24–bit memory over eight megabytes on a Modular Mac will be fragmented (see “Memory Fragmentation”), with the result that no single application can use all 14 megabytes under MultiFinder. In 32–bit mode, all of the memory up to one gigabyte is contiguous so that each application can access all the application memory. Memory Fragmentation Memory pre–fragmentation and fragmentation can limit the size of the largest application you can open. This can be an amount significantly below total application memory. Pre–fragmentation is an issue only in 24–bit mode on modular Macs using more than 8MB of application memory or Compact Macs using more than 4MB of application memory. Fragmentation occurs in both 24 and 32–bit modes in all Macs. In 24–bit mode, the extended memory created by VM, Virtual or MAXIMA is pre–fragmented at the 8 megabyte point on Modular Macs by the ROMs. (In 32–bit mode the fragmentation occurs at 1024MB, one gigabyte, and so, practically speaking is not an issue.) Similar pre–fragmentation occurs on the Plus, SE and Classic at the 4MB level. Pre–fragmentation can limit the size of the largest single application you can run using MultiFinder. You might have 14MB of application memory but not be able to open a single 8MB file. System 7 and System 6 MultiFinder can not assign a fragmented block of memory to any one program. This means that while running in 24–bit mode the largest zone for any one application is slightly less than 8 megabytes. The Largest Unused Block of memory is shown in the “About this Macintosh” (System 7) or “About the Finder” (System 6) window. If you run an application under System 6 in Finder, then all of the memory in the machine (up to 14 megabytes minus the size of the System) will be given to that application. Even then, the available memory is pre–fragmented and some limitations still apply. For example, you can have a 6 megabyte picture buffer, and a 6 megabyte “Undo” buffer but, with many applications, you can’t have a single 12 megabyte picture. NuBus cards can further pre–fragment memory, but you can arrange your slot cards to minimize the effect. On a Mac II, IIx, IIcx, IIfx or Quadra 700, you should put the cards away from the power supply. On the IIci and Quadra 900/950, put the cards towards the power supply. The memory map of the Compact Macs is even more pre–fragmented, with a largest unfragmented block of about 4MB out of the total 16MB. This means that you might have 16MB of physical RAM in a Compact Mac equipped to handle 4MB SIMMs and still not be able to open any one application larger than 4MB. Compact Virtual 3.0 overcomes this, however, creating an unfragmented block of as much as 12MB. In addition to the pre–fragmentation of memory by the ROMs, NuBus cards, and various hardware components of the Mac, memory can be further fragmented when applications are opened and then closed. The best way to show this is with an example. Consider a Mac IIci in 24–bit mode, running 12MB of application memory using Virtual. There will be two blocks of memory, low and high memory, pre–fragmented by the ROMs just above the 8MB level. In low memory, the System will always load at the bottom, occupying the lowest, let’s say, 2MB. So, low memory will have a block of memory of 8 minus 2 or about 6MB. In high memory the ROMs will take up the lowest 512K (just above 8MB) so it will have the space from 8.5MB to 12MB, a total of 3.5MB. The Largest Unused Block displayed under “About This Macintosh...” will be 6MB. When you open a new application, the System will always try to put it into the highest memory location that can hold it. So, if you open a 2.5MB application, it will go into the top of high memory. The Largest Unused Block will still be 6MB because this largest block was in low memory, which was unaffected. Now, if you open a second application, say one that takes 3.5MB, there won’t be enough room for it in high memory (which only has 1MB free now) and it will load into the top of low memory, just below the ROMs. Then the Largest Unused Block will be 6 minus 3.5 equals 2.5MB. If you now open a third, 2MB application it will go into low memory below the second one (again because it can’t fit into high memory). Now high memory has more contiguous free space (1MB) than low memory (.5MB) so the Largest Unused Block will be 1MB. If you then close the second (3.5MB) application you launched, you will fragment memory. Instead of the original two blocks, you will have three blocks of free memory: the low memory below the 2MB application (0.5MB), the low memory above the 2MB application (3.5MB) and the space left in high memory (1MB). Sometimes, after you have used your Mac for a while, memory becomes sufficiently fragmented because of Opening and Closing applications that you may need to close everything and start again.   Because memory is allocated this way, the size and number of applications you can open can be affected by the order in which you open them. So, if you plan to open several applications that will use up most of your memory, it’s often a good practice to start by opening the ones that will most nearly fill high memory. You thereby make the most out of your available memory. Using More Than 4MB On Compact Macintoshes The Mac Plus, SE and Classic are normally limited to 4MB. This can be a serious handicap, particularly under System 7. (This is not true of the Classic II nor the SE/30–see below.) Moreover, there is no support for 32–bit addressing mode on these Macs because of design limitations of the 68000 CPU. However, these three systems can use 16MB of physical RAM (four 4MB SIMMs) when the Mac is equipped with a compatible 68030 accelerator card and Compact Virtual 3.0. This is accomplished in 24–bit mode and does not require using virtual memory. If the accelerated Compact Mac has less than 16MB of physical RAM, Compact Virtual can create up to 16MB using virtual memory. Whether physical or virtual memory is used, Compact Virtual reorganizes the memory map so up to 12MB of the 16MB is contiguous (see “Memory Fragmentation”).   68030–accelerator cards are available today for the Mac Plus, SE, and Classic. They have street prices in the range of $300 to $850. The less expensive versions mainly provide virtual memory compatibility, since the “acceleration” is usually only 20–40%. The more expensive versions can triple (or more) the speed of typical operations. You get what you pay for. You often also get Compact Virtual for free since it’s bundled with most 68030 accelerators. The Classic II and SE/30 are different from the Plus, SE and Classic, having ROM software more like the Modular Macs. With no additional software, up to 8MB of memory can be addressed in 24–bit mode on these two systems, while only 4MB can be addressed using the other Compact Macs. So, for example, if you put a total of 10MB of RAM (adding two 4MB SIMMs) in a Classic II running System 7 with 32–bit addressing off, you would get 8MB of application memory. Turning 32–bit addressing on would let you access all 10MB. Similarly, if you install a memory card holding two 4MB SIMMs on a Classic (for a total of 10MB), you would only get 4MB of application memory. By installing Compact Virtual and a 68030 accelerator you could address up to 16MB on the accelerator board. To get 32–bit addressing on an SE/30 you need System 7 and MODE32, or System 6 and OPTIMA. 32–bit mode is standard with System 7 on the Classic II. It is not available at all on the Plus, SE or Classic. RAM Caches, Disks, and Drives We described how information has to be brought from the hard drive into RAM before it can be used by the CPU. Once executed, these instructions may be pushed out of RAM if the space is required to hold other information. Then, if these instructions are needed again, they must once more be copied from the hard drive. But instructions are often used repeatedly in short intervals (“loops” in the program, for example). So, the Mac contains a built–in adjustable RAM cache where information that was recently brought up from the hard drive can be stored in SIMM RAM. This speeds up access when recently used information is needed again right away. You can change the size of this cache in the control panel. However, increasing the RAM cache beyond some point, typically 128K, yields diminishing returns, and becomes a waste of potential application memory. The RAM cache is worth using but don’t expect dramatic results. Usually it speeds things up no more than 5–15%. This caching technique is used two more times on the Mac in caches that get progressively smaller, faster, and closer to the core of the processor itself. First, the Mac IIci and some IIsi math coprocessor cards support an add–on memory cache which can remember a small number of recently used instructions. It stores them in special RAM that can be accessed by the CPU even faster than data held in SIMM RAM. Memory caches produce surprisingly big speed improvements, often in the range of 15–30%. And since you add RAM, this cache does not reduce the amount of available application memory. The IIfx has a built–in cache with 64K of memory. Second, the processor itself often has a built–in cache that stores a very small number of recently used instructions. The 68020 has a 256 byte cache for instructions, the 68030 has two 256 byte caches (one for instructions and one for data), and the 68040 has two 4 kilobyte (4K) caches. (The 68000 does not have one.) Surprisingly, though 256 bytes is not enough space to hold even this one paragraph, the 68020 cache contains the information sought by the processor about 20% of the time. Computers do a lot of repetitive work! A RAM disk is a portion of the installed RAM which is not used for application memory, and instead is configured to work like a hard drive. RAM disks typically look like a hard drive on the desktop, and information can be added, accessed, modified, or removed in the same way as a hard drive, but at RAM speeds. RAM disks are a good place for large files that are frequently accessed. The traditional problem with RAM disks is that the contents are erased whenever power is turned off. The MAXIMA RAM disk solves this problem by maintaining a copy of the RAM disk contents on the hard drive, thus preserving the information whenever the system is shut down. It then automatically copies this information back up from the hard drive into the RAM disk when the Mac is rebooted. The MAXIMA RAM disk contents will also survive a crash or a Restart, as long as power is not interrupted. MAXIMA can often be used with RAM cards, which are NuBus cards populated with large quantities of RAM. RAM cards are usually used when the SIMM banks are completely filled, access to them is blocked by add on cards, or they are otherwise not useful. A RAM drive is a SCSI device, that is it is connected to the Mac in the same way an external hard drive is. Instead of having a spinning platter like a hard drive, it contains lots of RAM. RAM drives are expensive but they can be a lot faster than the very fastest ordinary hard drives. They are usually not as fast as RAM disks built out of SIMM RAM since they are slowed down by the data transfer through the SCSI connection. Bad Memory When you power up your Mac (perform a “cold start”), it performs a comprehensive memory test. Basically it tries to write information to all the address locations in the entire installed RAM and then performs an operation (called an XOR) on the contents to see if it produces the correct result. It then writes the opposite pattern (0’s where there were 1’s before and vice versa) and tests again. If it gets correct results both times, it validates the RAM. When you do a Restart (a “warm boot”) without interrupting power, a much more limited test is performed. In either case, if the Mac finds a problem before it validates enough memory to run the monitor, it gives a four note chime, colorfully known as the “Chimes of Death.” If it finds a problem after it validates enough memory to run the monitor, you get the Unhappy Mac image on the screen (along with codes that might tell a programmer something about what went wrong). There are several possible explanations. If you have just changed the RAM configuration in your Mac, or have just moved the Mac, it probably means the RAM is not securely seated in the SIMM sockets or slots. Try wiggling each SIMM a little and gently pressing it a little harder into the socket. If this doesn’t help, carefully remove the SIMMs and put them back in. If you still have problems, make sure you followed the Four SIMM Rules, have the right RAM for your machine (for example, PAL SIMMs for a II or IIx if they are over 1MB), and don’t have any obvious other culprits (like a loose add–on accelerator card.) If you get this far, you probably have at least one defective SIMM. If possible, try to boot you Mac with a different set of RAM and then use a process of swapping and elimination to find the bad SIMM. SIMMs don’t go bad often and when they do it is usually because they have recently been physically handled. It is possible for software to cause memory problems, too, although this is extremely rare. If your RAM seems to be OK, try turning off as many extensions as possible, reinstalling your System and running a virus checker.